'use strict';
define(function(require, exports, module) {

	return ['$http', function($http) {
		return {
			queryList: function(func) {
				$http({
					method: "GET",
					url: "./app/login/data/data.json"
				}).then(function(resp){
					if(typeof func == 'function')func(resp.data);
				});
			},

			queryById: function(id, func){
				$http({
					method: "GET",
					url: "./app/login/data/data.json"
				}).then(function(resp){
					var o = null;
					angular.forEach(resp.data, function(obj){
						if(obj.id == id){
							o = obj;
							return;
						}
					});
					if(typeof func == 'function')func(o);
				});
			}
		};

	}];

});